﻿// JScript 文件

function checkdata()
{
    var v1=checkUserName();
    var v2=checkPassword();
    var v3=checkPartnername();
    var v4=checkLinkman();
    var v5=checkTelphone();
    var v6=checkMobile();
    var v7=checkEmail();
    var v8=checkSiteName();
    var v9=checkSiteType();
    var v10=checkSiteUrl();
    var v15=checkAddress();
    var v16=checkPostNo();
    var v17=checkIdCard();
    var v18=checkPayType();
    var v19=checkRePassword();
    
    var v11=checkBankName();
    var v12=checkAccountNo();
    var v13=checkBankBook();
    var v14=checkOpenName();
    
//    if(!checkPayTypeValue("0"))
//    {
//        v11=true;
//        v12=true;
//        v13=true;
//        v14=true;
//    }
    if(v1 && v2 && v3 && v4 && v5 && v6 && v7 && v8 && v9 && v10 && v11 && v12 && v13 && v14 && v15 && v16 && v17 && v18 && v19)
    {
        return true;
    }
    else return false;
}
function checkUserName()
{
    var oValue=document.getElementById("username").value;
    var oSpan=document.getElementById("usernameSpan");
    if(oValue!=null && oValue!="")
    {
        var pattern=/^(?!_)(?!.*?_$)[a-zA-Z0-9_\u4e00-\u9fa5]{5,19}$/;
        if(pattern.test(oValue))
        {
            switch(ajaxFun.CheckPartnerUserName(oValue).value)
            {
                case 0:
                oSpan.className="regData_m_c4_2";
                oSpan.innerHTML="用户名可以使用";
                if(document.getElementById("domainnameflag").value=="0")
                {
                    document.getElementById("domainname").value=oValue+".5266.tv";
                    document.getElementById("domainnameflag").value="1";
                }
                return true;
                break;
                case 1:
                oSpan.className="regData_m_c4_1";
                oSpan.innerHTML="用户名已被使用";
                break;
            }
        }
        else
        {
            oSpan.className="regData_m_c4_1";
            oSpan.innerHTML="只允许汉字,字母,数字,下划线组成的长度为5~20个字符";//(下划线不能开头和结尾)
        }
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="用户名不能为空";
    }
}
function checkPassword()
{
    var oValue=document.getElementById("password").value;
    var oSpan=document.getElementById("passwordSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="密码已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="密码不能为空";
    }
}
function checkRePassword()
{
    var ooValue=document.getElementById("password").value;
    var oValue=document.getElementById("repassword").value;
    var oSpan=document.getElementById("repasswordSpan");
    if(oValue!=null && oValue!="")
    {
        if(checkPassword() && oValue==ooValue)
        {
            oSpan.className="regData_m_c4_2";
            oSpan.innerHTML="重复密码输入正确";
            return true;
        }
        else
        {
            oSpan.className="regData_m_c4_1";
            oSpan.innerHTML="重复密码输入不正确";
        }
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="重复密码不能为空";
    }
}
function checkPartnername()
{
    var oValue=document.getElementById("partnername").value;
    var oSpan=document.getElementById("partnernameSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="合作方名称已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="合作方名称不能为空";
    }
}
function checkLinkman()
{
    var oValue=document.getElementById("linkman").value;
    var oSpan=document.getElementById("linkmanSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="联系人已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="联系人不能为空";
    }
}
function checkTelphone()
{
    var oValue=document.getElementById("telphone").value;
    var oSpan=document.getElementById("telphoneSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="电话已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="电话不能为空";
    }
}
function checkMobile()
{
    var oValue=document.getElementById("mobile").value;
    var oSpan=document.getElementById("mobileSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="手机已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="手机不能为空";
    }
}
function checkEmail()
{
debugger;
    var oValue=document.getElementById("email").value;
    var oSpan=document.getElementById("emailSpan");
    if(oValue!=null && oValue!="")
    {
        var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
        if(pattern.test(oValue))
        {
            if(ajaxFun.CheckPartnerEmail(oValue).value)
            {
                oSpan.className="regData_m_c4_2";
                oSpan.innerHTML="邮箱已输入";
                return true;
            }
            else
            {
                oSpan.className="regData_m_c4_1";
                oSpan.innerHTML="邮箱已被使用";
            }
        }
        else
        {
            oSpan.className="regData_m_c4_1";
            oSpan.innerHTML="邮箱格式输入不正确";
        }
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="邮箱不能为空";
    }
}
function checkSiteName()
{
    var oValue=document.getElementById("sitename").value;
    var oSpan=document.getElementById("sitenameSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="网站名称已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="网站名称不能为空";
    }
}
function checkSiteType()
{
    var oValue=document.getElementById("sitetype").value;
    var oSpan=document.getElementById("sitetypeSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="网站类别已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="网站类别不能为空";
    }
}
function checkSiteUrl()
{
    var oValue=document.getElementById("siteurl").value;
    var oSpan=document.getElementById("siteurlSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="网站地址已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="网站地址不能为空";
    }
}
function checkBankName()
{
    var oValue=document.getElementById("bankname").value;
    var oSpan=document.getElementById("banknameSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="开户行已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="开户行不能为空";
    }
}
function checkAccountNo()
{
    var oValue=document.getElementById("accountno").value;
    var oSpan=document.getElementById("accountnoSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="卡号已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="卡号不能为空";
    }
}

//function SetPayType(paytype)
//{
//    if(paytype=="0")
//        document.getElementById("bankPayDiv").style.display="block";
//    else
//        document.getElementById("bankPayDiv").style.display="none";
//}
function checkPayType()
{
    var oValue=document.getElementById("paytype").value;
    var oSpan=document.getElementById("paytypeSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="结算银行已选择";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="请选择结算银行";
    }
}
function checkPayTypeValue(paytype)
{
    var oValue=document.getElementById("paytype").value;
    if(oValue==paytype)
        return true;
    else
        return false;    
}
function checkBankBook()
{
    var oValue=document.getElementById("bankbook").value;
    var oSpan=document.getElementById("bankbookSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="存折号已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="存折号不能为空";
    }
}
function checkOpenName()
{
    var oValue=document.getElementById("openname").value;
    var oSpan=document.getElementById("opennameSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="开户名已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="开户名不能为空";
    }
}
function checkAddress()
{
    var oValue=document.getElementById("address").value;
    var oSpan=document.getElementById("addressSpan");
    if(oValue!=null && oValue!="")
    {
        oSpan.className="regData_m_c4_2";
        oSpan.innerHTML="通讯地址已输入";
        return true;
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="通讯地址不能为空";
    }
}
function checkPostNo()
{
    var oValue=document.getElementById("postno").value;
    var oSpan=document.getElementById("postnoSpan");
    if(oValue!=null && oValue!="")
    {
        var pattern=/\d{6}/;
        if(pattern.test(oValue))
        {
            oSpan.className="regData_m_c4_2";
            oSpan.innerHTML="邮政编码已输入";
            return true;
        }
        else
        {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="邮政编码输入不正确";
        }
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="邮政编码不能为空";
    }
}
function checkIdCard()
{
    var oValue=document.getElementById("idcard").value;
    var oSpan=document.getElementById("idcardSpan");
    if(oValue!=null && oValue!="")
    {
        var pattern=/^\d{14}(\d{1}|\d{4}|(\d{3}[xX]))$/;
        if(pattern.test(oValue))
        {
            oSpan.className="regData_m_c4_2";
            oSpan.innerHTML="身份证号已输入";
            return true;
        }
        else
        {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="身份证号输入不正确";
        }
    }
    else
    {
        oSpan.className="regData_m_c4_1";
        oSpan.innerHTML="身份证号不能为空";
    }
}
